﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
using ZFY.UMC.BlazorWebAssembly.Shared;

namespace ZFY.UMC.BlazorWebAssembly.HttpServices
{
    public class CommonService
    {
        private readonly HttpClient _httpClient;

        public CommonService(HttpClient httpClient)
        {
            _httpClient = httpClient;
        }

        public async Task<List<NestedModel>> GetProvinceListAsync()
        {
            var res = await _httpClient.GetFromJsonAsync<List<NestedModel>>("province.json");

            Console.WriteLine(res is null);

            return res;
        }
    }
}
